@import '../../style/themes/index.less';

@gallery-prefix-cls: ~'@{prefix}-gallery';
@image-view-prefix-cls: ~'@{prefix}-image-view';

.@{gallery-prefix-cls} {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;

  &-popup {
    .weui-popup-mask {
      background: #000;
    }
  }

  &-wrapper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  & > &-container {
    touch-action: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  &-container .weui-swiper-carousel {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    touch-action: none;
  }
  &-container .weui-swiper-item {
    width: 100%;
    height: 100%;
  }

  &-ui {
    -webkit-font-smoothing: auto;
    visibility: visible;
    opacity: 1;
    z-index: 1550;
  }

  &-topbar {
    position: absolute;
    left: 0;
    top: 0;
    height: 88px;
    width: 100%;
    transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
    background-color: rgba(0, 0, 0, 0.3);
  }
  &-counter {
    position: absolute;
    left: 0;
    top: 0;
    height: 88px;
    font-size: 26px;
    line-height: 88px;
    color: #fff;
    opacity: 0.75;
    padding: 0 20px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  &-skin-btn {
    font-size: 42px;
    width: 88px;
    height: 88px;
    position: relative;
    background: none;
    cursor: pointer;
    overflow: visible;
    -webkit-appearance: none;
    display: block;
    border: 0;
    padding: 0;
    margin: 0;
    float: right;
    opacity: 0.75;
    -webkit-transition: opacity 0.2s;
    transition: opacity 0.2s;
    -webkit-box-shadow: none;
    box-shadow: none;
    color: #fff;
    background: url(./default-skin.png) 0 0 no-repeat;
    background-size: 528px 176px;

    &:focus {
      border: none;
      outline: none;
    }
  }

  .btn-close {
    background-position: 0 -88px;
  }
  .btn-share {
    background-position: -88px -88px;
  }
  .btn-zoom {
    background-position: -176px 0;
  }

  .btn-arrow-left {
    top: 50%;
    height: 60px;
    width: 64px;
    position: absolute;
    left: 0;
    background-color: rgba(0, 0, 0, 0.3);
    background-size: 528px 176px;
    background-position: -276px -88px;
  }
  .btn-arrow-right {
    top: 50%;
    height: 60px;
    width: 64px;
    position: absolute;
    right: 0;
    background-color: rgba(0, 0, 0, 0.3);
    background-size: 528px 176px;
    background-position: -188px -88px;
  }

  &-caption {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    min-height: 44px;
    transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
    background-color: rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
  }

  &-caption-inner {
    text-align: left;
    margin: 0 auto;
    font-size: 26px;
    padding: 20px;
    line-height: 40px;
    color: #ccc;

    small {
      font-size: 22px;
      color: #bbb;
    }
  }

  &-bottom {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    min-height: 44px;
    transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
    background: #0d0d0d;
    box-sizing: border-box;
    z-index: 10;
    color: #fff;
    font-size: 28px;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.@{image-view-prefix-cls} {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  touch-action: none;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;

  img {
    width: 100%;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    // pointer-events: none;
  }
}
